<template>
  <div class="left_container">
    <search-bar @query_click="handleQueryClick" @reset_click="handleResetClick" />
    <operation-bar ref="operation_bar" @click_create_item="handleClickCreateItem" />
    <pagination-table ref="pagination_table" @click_edit="handleClickEdit" @click_create_reception="handleReceprion"
      @click_alter="handleClickAlter" />
    <!-- 审核流程 -->
    <my-form-audit ref="my_form_audit" />
  </div>
</template>

<script>
import SearchBar from './search-bar'
import PaginationTable from './pagination-table'
/** 可选：表单组件，操作栏组件，抽屉组件 */
import MyFormAudit from './form/audit.vue'
import OperationBar from './operation-bar'
export default {
  name: 'ItemList',
  /** 可选：表单组件，操作栏组件，抽屉组件 */
  components: {
    SearchBar,
    PaginationTable,
    OperationBar,
    MyFormAudit
  },
  data () {
    return {
      activeName: 'left'
    }
  },
  methods: {
    handleClick (tab, event) {
      console.log(tab, event);
    },
    /** 搜索栏组件事件处理----------------------------------------------------------- */
    /** 点击查询栏【查询】按钮 */
    handleQueryClick (queryParams) {
      this.$refs['pagination_table'].handleQuery(queryParams)
    },
    /** 点击查询栏【重置】按钮 */
    handleResetClick () {
      this.$refs['pagination_table'].handleQuery(null)
    },
    /** 操作栏组件的事件处理 -----------------------------------------------------------*/
    /** 点击操作栏【采购申请】按钮 */
    handleClickCreateItem () {
      this.$emit('click_create_createitem')
    },
    // 表单组件事件处理
    /** 表单提交成功 */
    handleSubmitSuccess () {
      this.$refs['pagination_table'].refreshList()
    },
    /** 页码表格组件事件处理 -----------------------------------------------------------*/
    /** 点击列表【审核流程】按钮 */
    handleClickEdit (val) {
      this.$refs['my_form_audit'].openDialog(val)
    },
    /** 点击列表【重新申请】按钮 */
    handleClickAlter (id) {
      this.$emit('click_create_createitem', id)
    },
    // 传递子级id给父级tab标签
    handleReceprion (id) {
      this.$emit('click_create_receptiondate', id)
    }
  }
}
</script>
<style lang="scss" scoped>
.left_container {
  padding: 0;
}
</style>
